package ThaumPerditio.common;

import ThaumPerditio.common.registry.BlockRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.common.util.EnumHelper;

import ThaumPerditio.common.lib.LibCreativeTab;
import ThaumPerditio.common.lib.LibStrings;
import ThaumPerditio.common.handler.ConfigHandler;
import ThaumPerditio.common.handler.ThaumPerditioEventHandler;
import ThaumPerditio.common.registry.ResearchRegistry;

import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

@Mod (modid = LibStrings.MODID, name = LibStrings.NAME, version = LibStrings.VERSION, dependencies = LibStrings.DEPENDENCIES)
public class ThaumPerditio {
    @Mod.Instance ("ThaumPerditio")
    public static ThaumPerditio instance;

    // Proxies
    @SidedProxy (clientSide = "ThaumPerditio.client.ClientProxy", serverSide = "ThaumPerditio.common.CommonProxy")
    public static CommonProxy proxy;

    public static ThaumPerditioEventHandler ThaumPerditioEvents;
    public static CreativeTabs tabThaumPerditio = new LibCreativeTab();
    public static ConfigHandler configHandler;
    public static final Logger log = LogManager.getLogger("THAUMPERDITIO");

    // Pre init
    @EventHandler
    public static void preInit (FMLPreInitializationEvent event)
    {
        log.info("ThaumPerditio entered preInit...");
        // Config
        configHandler.config = new Configuration(event.getSuggestedConfigurationFile());
        configHandler.init();

        BlockRegistry.init();
        proxy.registerClientHandlers();
    }

    // Init
    @EventHandler
    public static void init (FMLInitializationEvent event)
    {
        log.info("ThaumPerditio entered Init...");
        //Rendering

    }

    // Post init
    @EventHandler
    public static void postInit (FMLPostInitializationEvent event)
    {
        log.info("ThaumPerditio entered postInit...");
        //Researches
        ResearchRegistry.initResearch();

        log.info("ThaumPerditio finished loading");
    }
}
